﻿#define _CRT_SECURE_NO_WARNINGS
#include "Hash.h"
#include <iostream>

using namespace std;

namespace close
{
	void test1()
	{
		HashTable<int, int> ht;
		int arr[] = { 3,13,8,18,6,16,26 };
		for (auto num : arr)
		{
			ht.insert(make_pair(num, num));
		}
		cout << ht.find(13) << endl;

		ht.insert(make_pair(7, 7));
		ht.insert(make_pair(17, 17));
		ht.insert(make_pair(9, 9));
		ht.insert(make_pair(19, 19));

		cout << ht.find(19) << endl;

	}
}

namespace bucket
{
	void test1()
	{
		HashTable<std::string, int> ht;
		//int arr[] = { 3,13,8,18,6,16,26 };
		std::string arr[] = { "苹果","香蕉","葡萄","苹果","苹果","葡萄","苹果","葡萄","苹果" };
		int i = 0;
		for (auto& str : arr)
		{
			std::cout << ht.insert(make_pair(str, i++)) << std::endl;
		}
		ht.insert(make_pair("西瓜", i++));

		ht.erase("苹果");

	}

	void test2()
	{
		HashTable<int, int> ht;
		int arr[] = { 3,13,8,18,6,16,26 };
		for (auto num : arr)
		{
			ht.insert(make_pair(num, num));
		}
		cout << ht.find(13) << endl;

		ht.insert(make_pair(7, 7));
		ht.insert(make_pair(17, 17));
		ht.insert(make_pair(9, 9));
		ht.insert(make_pair(19, 19));

		cout << ht.find(19) << endl;

	}
}

int main()
{
	bucket::test1();
	return 0;
}